function [hfun,gradh] = h_foc_log_const_sparse(h,alfa,g,xi,const)
%H_FOC_LOG
%    [HFUN,GRADH] = H_FOC_LOG(H,ALFA,G,XI,CONST)

%    This function was generated by the Symbolic Math Toolbox version 8.3.
%    23-May-2019 11:18:30

t2 = h.^alfa;
t3 = alfa-1.0;
t4 = 1.0./xi;
hfun = const-t3.*log(h)+t4.*log(-g+t2);
if nargout > 1
    N=length(h);
    gradh = -t3./h-(alfa.*h.^t3.*t4)./(g-t2);
    gradh = spdiags(gradh, 0, N, N);
end
